<?php

class myUser extends sfBasicSecurityUser
{
	/**
	 * Method to get user id
	 */
	function getUserId()
	{
		$user = $this->getAttribute('model');
		if($user)
			return $user->getId();
		return false;
	}
	/**
	 * Method to get user login
	 */
	function getLogin()
	{
		$user = $this->getAttribute('model');
		if($user)
			return $user->getLogin();
		return false;
	}
	/**
	 * Method to set user data into session
	 * @param $user
	 */
	function storeAutorization($user)
	{
		if(is_null($user))
		{
			$this->setAuthenticated(false);
			$this->setAttribute('model', null);
			return true;
		}
		$this->setAuthenticated(true);
		$this->setAttribute('model', $user);
		return true;
	}
}
